package com.myjavalab.thread;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

public class SimpleLog {
	public static void main(String[] args) {
		System.out.println("begin");
		for(int i = 0; i < 10; i++) {
			SimpleLog.println("main : i = " + i);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		SimpleLog.close();
		System.out.println("end");
	}
	private static PrintWriter writer = null;
	static {
		try {
			writer = new PrintWriter(new File("log.txt"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static void println(String s) {
		writer.println(s);
	}
	
	public static void close() {
		writer.println("------End of Log--------");
		writer.close();
	}
}
